var api = require('../../utils/api.js')

Page({
    data: {
        list: [],
        imgs:'/images/icons/logo.jpg'

    },
    onLoad() {

    },
    onShow() {
        var that=this;
        
        let user = wx.getStorageSync('user');
        if (!user) {
            wx.navigateTo({
                url: '/pages/login/login'
            });
        }

        api.post({
            url: 'user/index',
            data: {},
            success: data => {
                console.log(data) 
                that.setData({
                    user:data.data
                })
            }
        })


    },

    getqrcode(){
        api.get({
            url: 'wxapp/Getqrcode/getqrcode',
            data: {},
            success: data => {
                console.log(data.data);
            }
        });

    },
    nexturl(ret){
        console.log(ret);

        wx.navigateTo({
          url: ret.currentTarget.dataset.url
        })

    },
    showmsg(){
        wx.showToast({
          title: '欢迎使用！',
          icon:'none'
        })
    },
    exits(){
        wx.setStorageSync('user', '');
        wx.setStorageSync('token', '')
        wx.reLaunch({
          url: '/pages/login/login'
        })
    }
});